package com.raven.play.datalink.jdbc;

import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.jetbrains.annotations.Range;

@Data
@NoArgsConstructor
@AllArgsConstructor
@Builder
public class BatchExecutionOptions {

    @Range(from = 0, to = Integer.MAX_VALUE)
    @Builder.Default
    private long intervalMs = 0;
    @Range(from = 1, to = Integer.MAX_VALUE)
    @Builder.Default
    private int batchSize = 5000;

    public static BatchExecutionOptions defaults(){
        return new BatchExecutionOptions();
    }

    public boolean needTimer(){
        return intervalMs > 0;
    }
}
